
import 'package:flutter/material.dart';


/**
 * 红色计数小圆点
 */
class RedCircleCount extends StatelessWidget {
  final int count;
  String showTxt;
  RedCircleCount({Key key,
  @required this.count}):super(key:key);
  @override
  Widget build(BuildContext context) {
    showTxt = count > 99 ? "99+" : count < 0 ? "0" : count.toString();
    return Container(
      width: 20,
      height: 20,
      decoration: BoxDecoration(
        shape: BoxShape.circle,
        color: Colors.red,
      ),
      alignment: Alignment.center,
      child: Text(showTxt,style: TextStyle(color: Colors.white,fontSize: 10,fontWeight: FontWeight.normal,decoration: TextDecoration.none,),maxLines: 1,overflow: TextOverflow.visible,),
    );
  }
}
/**
 * 取消过度滚动效果
 */
class NullOverScrollBehavior extends ScrollBehavior{

  @override
  Widget buildViewportChrome(BuildContext context, Widget child, AxisDirection axisDirection) {
    // When modifying this function, consider modifying the implementation in
    // _MaterialScrollBehavior as well.
    switch (getPlatform(context)) {
      case TargetPlatform.iOS:
        return child;
      case TargetPlatform.android:
      case TargetPlatform.fuchsia:
        return GlowingOverscrollIndicator(
          child: child,
          showLeading: false,
          showTrailing: false,
          axisDirection: axisDirection,
          color: Theme.of(context).primaryColor,
        );
    }
    return null;
  }

}
